<p class="group-line">
   <span class="group-title">Thông tin bài viết</span>
</p>
<?php
	/*Hàm phân trang
	$exec_mysql = new execute_mysql_query();
	$g_func = new global_function();
	@$cur_page  = str_replace('-','',$_GET['page']);*/
?>
<table width="1024px" class="table-list">
	<tr class="table-header">
        <td width="35px">STT</td>
        <td width="300px">Tiêu đề</td>
        <td>Tóm tắt nội dung</td>
        <td width="70px">Cập nhật</td>
        <td width="70px">Xóa</td>
    </tr>
    <?php
		include_once('libs/htdu_core.php');
		$exec_mysql = new execute_mysql_query();
		/*
		@$g_func = new global_function();
		@$cur_page = $_GET['page'];
		$ROWS_PER_PAGE = 10;
		$total_record = $exec_mysql->execute("select id from node", 2);
		$begin = $g_func->get_begin($cur_page, $ROWS_PER_PAGE, $total_record);
		$result = $exec_mysql->execute("select * from node order by id_type, id desc limit $begin, $ROWS_PER_PAGE",0);
		*/
		@$id=$_POST['id'];
		@$idSelect = $_POST['idSelect'];
		if($id == 0)
		{
			$result = $exec_mysql->execute("select * from node order by id desc",0);
			$stt = $begin + 1;
			while($row = mysql_fetch_array($result))
			{
				echo '<tr>';
					echo '<td align="center">'.$stt++.'</td>';
					echo '<td>'.$row['title'].'</td>';
					echo '<td style="text-align:justify">'.cut($row['description'],180).'</td>';
					echo '<td align="center"><a href="admin_master_page.php?cmd=1&id='.$row['id'].'&act=edit" ><img src="img/ico_edit.png" /></a></td>';
					echo '<td align="center"><img src="img/ico_delete.png" onclick="showConfirm(\'Xác nhận\', \'Bạn có chắc muốn xóa không?\', \'admin_master_page.php?cmd=4.2&act=del&id='.$row['id'].'\')" class="del" /></td>';
				echo '</tr>';
			}
		}
		else 
		{
			$result = $exec_mysql->execute("select * from node where id_type = $id order by id desc",0);
			$stt = $begin + 1;
			while($row = mysql_fetch_array($result))
			{
				echo '<tr>';
					echo '<td align="center">'.$stt++.'</td>';
					echo '<td>'.$row['title'].'</td>';
					echo '<td style="text-align:justify">'.cut($row['description'],180).'</td>';
					echo '<td align="center"><a href="admin_master_page.php?cmd=1&id='.$row['id'].'&act=edit" ><img src="img/ico_edit.png" /></a></td>';
					echo '<td align="center"><img src="img/ico_delete.png" onclick="showConfirm(\'Xác nhận\', \'Bạn có chắc muốn xóa không?\', \'admin_master_page.php?cmd=4.2&act=del&id='.$row['id'].'\')" class="del" /></td>';
				echo '</tr>';
			}
		}
	?> 
</table>
<div class="phan_trang">
	<?php
	//	$g_func->admin_paging($total_record,$ROWS_PER_PAGE);
	?>
</div>

<?php
function cut($str, $len) {
    $str = trim($str);
    if (strlen($str) <= $len) return $str;
    $str = substr($str, 0, $len);
    if ($str != "") {
        if (!substr_count($str, " ")) return $str." ...";
        while (strlen($str) && ($str[strlen($str) - 1] != " ")) $str = substr($str, 0, -1);
        $str = substr($str, 0, -1)." ...";
    }
    return $str;
}	
?>